﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
namespace DataAccess.Menu
{
    public class MenuDAL
    {
        private SQLDataAccess db;
        public MenuDAL()
        {
            db = new SQLDataAccess();
        }
        public DataTable getMenuType(int menutypeid, int langid)
        {
            return db.exeSelect("select * from Menu m join MenuLang ml on m.MenuID = ml.MenuID where LangID = " + langid + " and Enable = 1 and MenuTypeID=" + menutypeid + " and ParentID is null");
        }
        public DataTable getsubmenus(int menutypeid, int langid)
        {
            return db.exeSelect("select * from Menu m join MenuLang ml on m.MenuID = ml.MenuID where LangID = " + langid + " and Enable=1 and ParentID=" + menutypeid);
        }
        public DataTable getMenubyParentID(int menutypeid, int parentid, int langid)
        {
            return db.exeSelect("select * from Menu m join MenuLang ml on m.MenuID = ml.MenuID where LangID = " + langid + " and Enable=1 and MenuTypeID=" + menutypeid + " and parentid =" + parentid + "");
        }
        public DataTable getmainmenu(int langid)
        {
            return db.exeSelect("select * from MainMenu m join MainMenuLang ml on m.MenuID = ml.MenuID where LangID = " + langid + " and Enable=1 and ParentID is null order by OrderSort asc");
        }
        public DataTable getsubmainmenus(int ParentID,int langid)
        {
            return db.exeSelect("select * from MainMenu m join MainMenuLang ml on m.MenuID = ml.MenuID where LangID = " + langid + " and Enable=1 and ParentID=" + ParentID);
        }

       
    }
}
